package com.ybkj.daijia.server.sales;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ybkj.daijia.server.model.Company;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 活动
 *
 * @author Shine
 */
public class Activity implements Serializable {

    public static final int ACTIVITY_STATUS_NOTSTART = 0;
    public static final int ACTIVITY_STATUS_ONUSING = 1;
    public static final int ACTIVITY_STATUS_OVERDUE = 2;
    public static final int ACTIVITY_FREETYPE_FREEALL = 0;
    public static final int ACTIVITY_FREETYPE_FREEPART = 1;
    public static final int ACTIVITY_FREETYPE_FREEOTHER = 2;
    public static final String ZHUANXIAN = "zhuanxian";
    public static final String ZHUANCHE = "zhuanche";
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private Long id;

    private String created;

    private String updated;

    private ActivityType activityType;// 活动类型

    private ActivityTarget activityTarget;// 活动对象

    private ActivityEvent activityEvent;// 活动事件

    private String companyIds;

    private String companyNames;

    private String gradeIds;// 客户等级id

    private String gradeNames;// 客户等级名称

    private Integer completeTimes;// 每完成completeTimes次代驾 奖励

    private Integer restriction;// 限制领取次数

    private Integer shareTimes;// 满足的分享次数

    private String activityContent;// 活动规则

    private String passengerFromSource;// 客户来源

    private String orderFromSource;// 订单来源

    private OrderType orderType;// 订单类型 代驾 专车

    private BigDecimal money;// 返现金额

    private String couponIds;// 优惠券id，临时

    private String couponAmounts;// 优惠券数量，临时

    private List<ActivityCouponRule> activityCouponRules;// 活动选择的优惠券

    private Long companyId;

    private Company company;

    private boolean stoped;// 是否停止

    private Long start;// 开始时间

    private Long end;// 结束时间

    private String messageType;// 通知方式

    private String activityImage;// 活动图片

    private String backgroudColor;// 背景颜色

    private String sharePlatforms;

    private String sharePlatformNames;

    private Integer freeType;// 0全部免费 1免除起步价 2自定义

    private BigDecimal otherMoney;// 自定义价格

    private Double percentPrice;// 百分比价格

    private BigDecimal rechargingMoney;// 充值送券、送现金

    private String appKey;

    private Long lineId;

    private String lineName;

    /**
     * 快车订单客户评价等级 1级：完成星级评价 2级：完成选择评价 3级：完成自主输入评价
     */
    private Integer reviewGrade;

    /**
     * 活动范围（zhuanxian、zhuanche）
     */
    private String activityRange;

    public String getActivityRange() {
        return activityRange;
    }

    public void setActivityRange(String activityRange) {
        this.activityRange = activityRange;
    }

    public Integer getReviewGrade() {
        return reviewGrade;
    }

    public void setReviewGrade(Integer reviewGrade) {
        this.reviewGrade = reviewGrade;
    }

    public Long getLineId() {
        return lineId;
    }

    public void setLineId(Long lineId) {
        this.lineId = lineId;
    }

    public String getLineName() {
        return lineName;
    }

    public void setLineName(String lineName) {
        this.lineName = lineName;
    }

    public BigDecimal getRechargingMoney() {
        return rechargingMoney;
    }

    public void setRechargingMoney(BigDecimal rechargingMoney) {
        this.rechargingMoney = rechargingMoney;
    }

    public Double getPercentPrice() {
        return percentPrice;
    }

    public void setPercentPrice(Double percentPrice) {
        this.percentPrice = percentPrice;
    }

    public Integer getFreeType() {
        return freeType;
    }

    public void setFreeType(Integer freeType) {
        this.freeType = freeType;
    }

    public BigDecimal getOtherMoney() {
        return otherMoney;
    }

    public void setOtherMoney(BigDecimal otherMoney) {
        this.otherMoney = otherMoney;
    }

    public String getBackgroudColor() {
        return backgroudColor;
    }

    public void setBackgroudColor(String backgroudColor) {
        this.backgroudColor = backgroudColor;
    }

    public String getActivityImage() {
        return activityImage;
    }

    public void setActivityImage(String activityImage) {
        this.activityImage = activityImage;
    }

    public String getActivityContent() {
        return activityContent;
    }

    public void setActivityContent(String activityContent) {
        this.activityContent = activityContent;
    }

    public Integer getRestriction() {
        return restriction;
    }

    public void setRestriction(Integer restriction) {
        this.restriction = restriction;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCreated() {
        return created;
    }

    public void setCreated(String created) {
        this.created = created;
    }

    public String getUpdated() {
        return updated;
    }

    public void setUpdated(String updated) {
        this.updated = updated;
    }

    public BigDecimal getMoney() {
        return money;
    }

    public void setMoney(BigDecimal money) {
        this.money = money;
    }

    public ActivityType getActivityType() {
        return activityType;
    }

    public void setActivityType(ActivityType activityType) {
        this.activityType = activityType;
    }

    public ActivityTarget getActivityTarget() {
        return activityTarget;
    }

    public void setActivityTarget(ActivityTarget activityTarget) {
        this.activityTarget = activityTarget;
    }

    public Long getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }

    public Company getCompany() {
        return company;
    }

    public void setCompany(Company company) {
        this.company = company;
    }

    public boolean isStoped() {
        return stoped;
    }

    public void setStoped(boolean stoped) {
        this.stoped = stoped;
    }

    public Integer getCompleteTimes() {
        return completeTimes;
    }

    public void setCompleteTimes(Integer completeTimes) {
        this.completeTimes = completeTimes;
    }

    public Long getStart() {
        return start;
    }

    public void setStart(Long start) {
        this.start = start;
    }

    @JsonIgnore
    public Date getStartDate() {
        return new Date(start);
    }

    public Long getEnd() {
        return end;
    }

    public void setEnd(Long end) {
        this.end = end;
    }

    @JsonIgnore
    public Date getEndDate() {
        if (null == end) {
            return null;
        } else {
            return new Date(end);
        }
    }

    public String getGradeIds() {
        return gradeIds;
    }

    public void setGradeIds(String gradeIds) {
        this.gradeIds = gradeIds;
    }

    public String getCouponIds() {
        return couponIds;
    }

    public void setCouponIds(String couponIds) {
        this.couponIds = couponIds;
    }

    public String getCouponAmounts() {
        return couponAmounts;
    }

    public void setCouponAmounts(String couponAmounts) {
        this.couponAmounts = couponAmounts;
    }

    public Integer getTimeStatus() {
        if (start > System.currentTimeMillis()) {
            return ACTIVITY_STATUS_NOTSTART;
        } else if (null != end && end < System.currentTimeMillis()) {
            return ACTIVITY_STATUS_OVERDUE;
        } else {
            return ACTIVITY_STATUS_ONUSING;
        }
    }

    public Integer getSort() {
        if (stoped) {
            return 2;
        }
        if (start > System.currentTimeMillis()) {
            return 1;
        } else if (null != end && end < System.currentTimeMillis()) {
            return 2;
        } else {
            return 0;
        }
    }

    public Integer getShareTimes() {
        return shareTimes;
    }

    public void setShareTimes(Integer shareTimes) {
        this.shareTimes = shareTimes;
    }

    public String getGradeNames() {
        return gradeNames;
    }

    public void setGradeNames(String gradeNames) {
        this.gradeNames = gradeNames;
    }

    public OrderType getOrderType() {
        return orderType;
    }

    public void setOrderType(OrderType orderType) {
        this.orderType = orderType;
    }

    public List<ActivityCouponRule> getActivityCouponRules() {
        return activityCouponRules;
    }

    public void setActivityCouponRules(List<ActivityCouponRule> activityCouponRules) {
        this.activityCouponRules = activityCouponRules;
    }

    public ActivityEvent getActivityEvent() {
        return activityEvent;
    }

    public void setActivityEvent(ActivityEvent activityEvent) {
        this.activityEvent = activityEvent;
    }

    public String getAppKey() {
        return appKey;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }

    public String getCompanyIds() {
        return companyIds;
    }

    public void setCompanyIds(String companyIds) {
        this.companyIds = companyIds;
    }

    public String getCompanyNames() {
        return companyNames;
    }

    public void setCompanyNames(String companyNames) {
        this.companyNames = companyNames;
    }

    public String getPassengerFromSource() {
        return passengerFromSource;
    }

    public void setPassengerFromSource(String passengerFromSource) {
        this.passengerFromSource = passengerFromSource;
    }

    public String getOrderFromSource() {
        return orderFromSource;
    }

    public void setOrderFromSource(String orderFromSource) {
        this.orderFromSource = orderFromSource;
    }

    public String getMessageType() {
        return messageType;
    }

    public void setMessageType(String messageType) {
        this.messageType = messageType;
    }

    public String getSharePlatforms() {
        return sharePlatforms;
    }

    public void setSharePlatforms(String sharePlatforms) {
        this.sharePlatforms = sharePlatforms;
    }

    public String getSharePlatformNames() {
        return sharePlatformNames;
    }

    public void setSharePlatformNames(String sharePlatformNames) {
        this.sharePlatformNames = sharePlatformNames;
    }

    public String getActivityEventName() {
        if (null != activityEvent) {
            if (activityEvent.equals(ActivityEvent.newRegister)) {
                return "新客户注册";
            } else if (activityEvent.equals(ActivityEvent.adminGift)) {
                return "手动赠送优惠券";
            } else if (activityEvent.equals(ActivityEvent.phoneGift)) {
                return "输入手机号赠送优惠券或金额";
            } else if (activityEvent.equals(ActivityEvent.shareSuccess)) {
                return "分享成功";
            } else if (activityEvent.equals(ActivityEvent.orderCompleteTimes)) {
                return "完成订单";
            } else if (activityEvent.equals(ActivityEvent.invite)) {
                return "邀请客户";
            } else if (activityEvent.equals(ActivityEvent.firstOrderFree)) {
                return "首单免费";
            } else if (activityEvent.equals(ActivityEvent.recharging)) {
                return "充值送礼";
            } else {
                return null;
            }
        } else {
            return null;
        }
    }

    public enum OrderType {
        /**
         * 代驾
         */
        daijia,
        /**
         * 专车
         */
        zhuanche,
        /**
         * 货运
         */
        freight,
        /**
         * 跑腿
         */
        errand,
        /**
         * 专线
         */
        zhuanxian
    }

    public enum ActivityType {
        /**
         * 返现
         */
        cash,
        /**
         * 反劵
         */
        coupon
    }


    public enum PassengerFromSource {

        电话预约, 司机补单, APP预约, 微信预约, 客户经理, 网站预约, 推荐,

    }

    public enum OrderFromSource {

        电话预约, 司机补单, APP预约, 微信预约, 客户经理, 网站预约

    }

    public enum ActivityEvent {
        /**
         * 新注册
         */
        newRegister,
        /**
         * 手动赠送优惠券
         */
        adminGift,
        /**
         * 输入手机号赠送优惠券或金额
         */
        phoneGift,
        /**
         * 分享成功
         */
        shareSuccess,
        /**
         * 完成代驾满n次
         */
        orderCompleteTimes,
        /**
         * 邀请
         */
        invite,
        /**
         * 充值满m元
         */
        recharging,
        /**
         * 首单免费
         */
        firstOrderFree,
        /**
         * 线路赠送优惠券
         */
        lineCoupon,
        /**
         * 快车优惠
         */
        zhuancheCoupon,
        /**
         * 快车订单评价送订单
         */
        reviewCoupon
    }

    public enum ActivityTarget {
        /**
         * 全部会员
         */
        all,
        /**
         * 个人会员
         */
        passenger,
        /**
         * 企业会员
         */
        enterprise
    }

}
